package com.xianyu.us.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.xianyu.us.pojo.entity.UsPayOrderParam;
import com.xianyu.us.service.UsOrderService;
import com.xianyu.us.service.UsPayService;

/**
 * 操作订单相关入口
 * @author wangshili
 *
 */
@RequestMapping("/order/")
@Controller
public class UsOrderController {
	
	@Autowired
	private UsOrderService usOrderService;
	
	/**
	 * 付款成功后会异步通知到此地址
	 * @param params
	 * @return
	 */
	@RequestMapping("notify")
	@ResponseBody
	public String notify(UsPayOrderParam params) {
		/*存入数据库*/
		System.out.println("异步通知");
		usOrderService.insertOrder(params);
		System.out.println("插入订单成功");
		return "success";//如果成功必须返回success,支付宝规定，否则不断重复该请求
	}
}
